package com.mright.step01.api;

import com.alibaba.dubbo.config.ApplicationConfig;
import com.alibaba.dubbo.config.ReferenceConfig;
import com.alibaba.dubbo.config.RegistryConfig;
import com.alibaba.dubbo.config.ServiceConfig;

import java.io.IOException;

/**
 * @author zhaochuanzhen
 * @since 2022/2/10 11:52 下午
 */
public class EchoConsumer {

    public static void main(String[] args) throws IOException {
        ReferenceConfig<EchoApi> referenceConfig = new ReferenceConfig<>();
        referenceConfig.setApplication(new ApplicationConfig("echo_api_consumer"));
        referenceConfig.setRegistry(new RegistryConfig("zookeeper://127.0.0.1:2181"));
        referenceConfig.setInterface(EchoApi.class);

        final EchoApi echoApi = referenceConfig.get();
        final String echo = echoApi.echo("hello world! 你好，世界！");
        System.out.println(echo);

    }
}
